<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>缴存历史记录</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"content="width=device-width, initial-scale=1, maximum-scale=1">
<script src="../../../js/angular.js"></script>
<script src="../../../js/angular.js" charset="utf-8"></script>
<link rel="stylesheet" href="../../../layui/css/layui.css" media="all">
<script type="text/javascript" src="../../../layui/lay/modules/layer.js"></script>
<script src="../../../layui/jquery-3.2.1.min.js" charset="utf-8"></script>
<script src="../../../layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="fy.js"></script>

<body>
	<br>
	<div ng-app="myApp" ng-controller="customersCtrl" align="center">
	<Loading></Loading>
		<div ng-hide="zy">
		证件号码：<input type="text" ng-model="SFZH" style="width: 15%">
		
		<input type="button" ng-click="cx()" style="width: 10%" value="查&nbsp;&nbsp;询">
		<table class="layui-table" style="width:90%">
			<tr align="center" style="background-color:#f1f1f1">
			<td ng-show=false>当前行数</td>
			<td ng-show=false>原单位</td>
			<td ng-show=false>原地区</td>
				<td>姓名</td>
				<td>证件号码</td>
				<td>缴存情况</td>
				<td>最后缴交时间</td>
				<td>单位账号</td>
				<td>单位名称</td>
				<td>操作</td>

			</tr>
			<tr ng-repeat="x in names" align="center">
				<td ng-if="$odd" ng-show=false style="background-color:#f1f1f1">{{ $index+1 }}</td>
				<td ng-if="$even" ng-show=false >{{ $index+1 }}</td>
				<td ng-if="$odd" ng-show=false style="background-color:#f1f1f1">{{ DWZH }}</td>
				<td ng-if="$even" ng-show=false >{{ DWZH }}</td>
				<td ng-if="$odd" ng-show=false style="background-color:#f1f1f1">{{ DQM }}</td>
				<td ng-if="$even" ng-show=false >{{ DQM }}</td>
				<td ng-if="$odd" style="background-color:#f1f1f1">{{ x.XINGMING }}</td>
				<td ng-if="$even">{{ x.XINGMING }}</td>
				<td ng-if="$odd" style="background-color:#f1f1f1">{{ x.ZJHM }}</td>
				<td ng-if="$even">{{ x.ZJHM }}</td>
				<td ng-if="$odd" style="background-color:#f1f1f1">{{ x.JCQK
					}}</td>
				<td ng-if="$even">{{ x.JCQK }}</td>
				<td ng-if="$odd" style="background-color:#f1f1f1">{{ x.ZHJJSJ
					}}</td>
				<td ng-if="$even">{{ x.ZHJJSJ }}</td>
				<td ng-if="$odd" style="background-color:#f1f1f1">{{ x.DWZH
					}}</td>
				<td ng-if="$even">{{ x.DWZH }}</td>
				<td ng-if="$odd" style="background-color:#f1f1f1">{{ x.DWMC }}</td>
				<td ng-if="$even">{{ x.DWMC }}</td>
				<td ng-if="$odd" style="background-color:#f1f1f1"><input type="button" ng-click="ny($index)"  style="color: red" value="&nbsp;调&nbsp;&nbsp;入&nbsp;"></td>
				<td ng-if="$even"><input type="button" ng-click="ny($index)" style="color: red" value="&nbsp;调&nbsp;&nbsp;入&nbsp;"></td>
			</tr>
		</table>
		<div class="layui-btn-group">
			<button class="layui-btn layui-btn-primary layui-btn-sm"
				ng-click="Sy()">首页</button>
			<button class="layui-btn layui-btn-primary layui-btn-sm"
				ng-click="Previous()">上一页</button>
			<button ng-repeat="page in pageList" class="layui-btn layui-btn-primary layui-btn-sm "
				ng-click="selectPage(page)" >{{page}}</button>
			<button class="layui-btn layui-btn-primary layui-btn-sm"
				ng-click="Next()">下一页</button>
			<button class="layui-btn layui-btn-primary layui-btn-sm"
				ng-click="Wy()">尾页</button>
			<button class="layui-btn layui-btn-primary layui-btn-sm "
				>{{selPage}}/{{pages}}</button>
		</div>
	</div>
	<div ng-hide="dc" style="width: 70%" id="xz">
 	<br><br>
		<div class="layui-form-item">
			<div class="layui-inline" >
				<label class="layui-form-label">姓名:</label>
				<div class="layui-input-inline">
					<input type="text" readonly="readonly" id="XINGMING" autocomplete="off"
						class="layui-input">
				</div>
			</div>
			<div class="layui-inline" >
				<label class="layui-form-label">证件号码:</label>
				<div class="layui-input-inline">
					<input type="text" readonly="readonly"    id="ZJHM" autocomplete="off"
						class="layui-input">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline" >
				<label class="layui-form-label">个人账号:</label>
				<div class="layui-input-inline">
					<input type="text"  readonly="readonly"  id="GRZH" autocomplete="off"
						class="layui-input">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">调入地区:</label>
				<div class="layui-input-inline">
					<input type="text" id="DRDQ" placeholder="请输入调入地区" autocomplete="off"
						class="layui-input">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">原地区编码:</label>
				<div class="layui-input-inline">
					<input type="text"  id="DQDM" readonly="readonly" autocomplete="off"
						class="layui-input">
				</div>
			</div>
			<div class="layui-inline" >
				<label class="layui-form-label">调入单位:</label>
				<div class="layui-input-inline">
					<input type="text"   id="DRDW"  placeholder="请输入调入单位" autocomplete="off"
						class="layui-input">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline" align="left">
				<label class="layui-form-label">原单位账号:</label>
				<div class="layui-input-inline">
					<input type="text" id="DWZH" readonly="readonly" autocomplete="off"
						class="layui-input">
				</div>
			</div>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<div class="layui-inline" >
				<div class="layui-input-inline">
					<input type="button" class="layui-btn layui-btn-primary" id="submit" value="确认调入">
				</div>
			</div>
		</div>
		
				
			
	</div>
</div>
	<script type="text/javascript">
		function getPath() {
			return 'http://' + location.host;
		};
		var a;
		var app = angular.module('myApp', []);
		 app.directive('loading', function(){  
		        return {  
		            restrict: 'E',  
		            transclude: true,  
		            template: '<div ng-show="loading" class="loading" id="allDiv"  style="position:fixed; top:0px; left:0px; width:100%; height:100%; display:none; background-color:#000; opacity: 0.5; z-index:99999;">'  
		            +'<img alt="" src="../../../layui/img/jz.gif" style="vertical-align: middle;width:30px; height:30px; position: absolute; top:50%; left:50%; margin-top: -50px; margin-left:-50px;"/>'
		            +'</div>',  
		            link: function (scope, element, attr) {  
		                scope.$watch('loading', function (val) {  
		                    if (val){  
		                        document.getElementById("allDiv").style.display = "block";  
		                    }else{  
		                        document.getElementById("allDiv").style.display = 'none';  
		  
		                    }  
		                });  
		            }  
		        };
		    }); 
		app.controller('customersCtrl', function($scope, $http) {
		  $scope.setLoading =function(){  
			    if($scope.loading ==undefined || $scope.loading ==false){  
			        $scope.loading=true;  
			    }else{  
			        $scope.loading=false;  
			    };
			};
			$scope.dc = true;
			
		  $scope.cx = function () {
				$scope.params={SFZH:$scope.SFZH};
				if($scope.SFZH=="" || $scope.SFZH==null){
						layer.alert("证件号码不可为空！");
				}else{
				 $scope.setLoading ();
			$http({
				url:getPath() + "/wsyyt/rydrcontroller/test",
				contentType:"text/html;charset=utf-8",
				method:'post',
				params:$scope.params,
				
         			
			})
					.then(
							function(res) {
							 $scope.setLoading();
								$scope.data = res.data.data;//自己打断点看格式:[{},{}]
									$scope.names="";
									$scope.selPage="";
									$scope.selectPage="";
									$scope.pages="";
									$scope.page="";
									$scope.pageList="";
									layer.msg('提示：'+res.data.msg);		
									a = res.data.CNT;
								$scope.pageSize = 6;//设置显示行数
      $scope.pages = Math.ceil($scope.data.length / $scope.pageSize); //分页数
      $scope.newPages = $scope.pages > 5 ? 5 : $scope.pages;
      $scope.pageList = [];
      $scope.selPage = 1;
      //设置表格数据源(分页)
      $scope.setData= function () {
        $scope.names = $scope.data.slice(($scope.pageSize * ($scope.selPage - 1)), ($scope.selPage * $scope.pageSize));//通过当前页数筛选出表格当前显示数据
      }
      $scope.names = $scope.data.slice(0, $scope.pageSize);
      //分页要repeat的数组
      for (var i = 0; i < $scope.newPages; i++) {
        $scope.pageList.push(i + 1);
      }
      //打印当前选中页索引
      $scope.selectPage = function (page) {
      
        //不能小于1大于最大
        if (page < 1 || page > $scope.pages) return;
      
        //最多显示分页数5
        if (page >2) {
          //因为只显示5个页数，大于2页开始分页转换
          var newpageList = [];
          for (var i = (page - 3) ; i < ((page + 2) > $scope.pages ? $scope.pages : (page + 2)) ; i++) {
            newpageList.push(i + 1);
          }
          $scope.pageList = newpageList;
        }
         else if (page ==1||page==2) {
          //因为只显示5个页数，大于2页开始分页转换
          var newpageList = [];
          for (var i = 1 ; i < 6; i++) {
            newpageList.push(i);
          }
          $scope.pageList = newpageList;
        }
        $scope.selPage = page;
        $scope.setData();
        $scope.isActivePage(page);
        console.log("选择的页：" + page);
      };
      //设置当前选中页样式
      $scope.isActivePage = function (page) {
        return $scope.selPage == page;
      };
      //上一页
      $scope.Previous = function () {
        $scope.selectPage($scope.selPage - 1);
      }
      //下一页
      $scope.Next = function () {
        $scope.selectPage($scope.selPage + 1);
        var a;
      };
        $scope.Sy = function () {
        $scope.selectPage(1);
      };
         $scope.Wy = function () {
        $scope.selectPage( $scope.pages);
      };
       $scope.ny = function (index) {
       			$scope.zy = false;
       			$scope.dc = true;
       			 $scope.setLoading();
   						$http({
							url:getPath() + "/wsyyt/rydrcontroller/dc",
							contentType:"text/html;charset=utf-8",
							method:'post',
							params:{GRZH:$scope.data[index].GRZH,YDQ:$scope.data[index].DQM,YDW:$scope.data[index].DWZH}				
						})
					.then(function(res) {
					 $scope.setLoading();
						var code = res.data.code;
								$scope.names="";
								$scope.selPage="";
								$scope.selectPage="";
								$scope.pages="";
								$scope.page="";
								$scope.pageList="";
								layer.msg('提示：'+res.data.msg);		
								return null;						
					});
     			 };     
			});
		};
	};					
});
		
	</script>		
<script src="../../../layui/jquery-3.2.1.min.js" charset="utf-8"></script>
<script type="text/javascript">
		$("#submit").click(function() {
			var XINGMING=$("#XINGMING").val();
			var GRZH=$("#GRZH").val();
			var ZJHM=$("#ZJHM").val();
			var DRSJ=$("#date1").val();
			var YDQ=$("#DQMC").val();
			var DRDW=$("#DRDW").val();
			var YDW=$("#DWMC").val();
			var DRDQ=$("#DRDQ").val();
			if((DRSJ && DRDW && DRDQ)!=null ||(DRSJ && DRDW && DRDQ)!=""){
						$.ajax({
								url : getPath()+'/wsyyt/rydrcontroller/dc',
								method : 'post',
								dataType : 'JSON',
								data: {'XINGMING':XINGMING,'GRZH':GRZH,'DRSJ':DRSJ,'YDQ':YDQ,'DRDW':DRDW,'YDW':YDW,'ZJHM':ZJHM,'DRDQ':DRDQ,},
								success : function(result) {
									var code = result.code;
									if(code==0){
											layer.alert("调出成功");
										// window.location.href =getPath()+'/wsyyt/dwbjhjqccontroller/test1';
										  
									}else{				
											layer.alert("调出失败");
										//window.location.href =getPath()+'/wsyyt/login/login.html';
										
									};
								}
							});	
				};
		});
	
	
</script>
<script src="../../../layui/layui.js" charset="utf-8"></script>
<script type="text/javascript">
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
  
  //日期
  laydate.render({
    elem: '#date'
  });
  laydate.render({
    elem: '#date1'
  });
});
</script>
</body>
</html>
